package menu;

import base.Main;
import objects.GruClass;
import objects.GruObject;

public class AddToArrayFieldMenuItem extends MenuItem {
	public GruObject field;
	public GruClass objectClass;
	
	public AddToArrayFieldMenuItem( String caption, GruObject field, GruClass objectClass ) {
		super( caption );
		this.field = field;
		this.objectClass = objectClass;
	}
	
	@Override
	public void select() {
		object.toGruObject().addToField( field, objectClass.createDataObject() );
		Main.refresh();
	}
}